package io.renren.modules.sp.entity;

import lombok.Data;

import java.awt.*;
import java.io.Serializable;

/**
 * 填充图像内容对象
 * @author 峰影
 */
@Data
public class ContentEntity implements Serializable {

    /**
     * 是否图片
     */
    private boolean img = false;
    /**
     * 文本内容，如果是图片类型则存放文件路径 "D:\\data\\f.jpg"
     */
    private String content = "张 三";
    /**
     * 起始点距离图片左侧的距离占整幅图片宽度的百分比，4位小数
     */
    private float widthPer = 274f/1283;
    /**
     * 起始点距离图片上方的距离占整幅图片高度的百分比，4位小数
     */
    private float heightPer = 527f/907;
    /**
     * 字体
     */
    private String fontFamily = "楷体";
    /**
     * 字体大小
     */
    private Integer fontSize = 21*4;
    /**
     * 字体间距，默认采用字体大小
     */
    private Integer fontSpace;
    /**
     * 字体样式
     * 取值：0 PLAIN, 1 BOLD, 2 ITALIC
     */
    private Integer fontStyle = 0;

    /**
     * 字体方向 0：水平 1：垂直
     */
    private Integer fontDirection = 0;

    /**
     * 图片宽
     */
    private Integer imgWidth;

    /**
     * 图片高
     */
    private Integer imgHeight;
    /**
     * 颜色
     */
    private Color fontColor = new Color(12, 12, 12);

    public ContentEntity(){

    }


    public ContentEntity(boolean img, float widthPer, float heightPer){
        this.img = img;
        this.widthPer = widthPer;
        this.heightPer = heightPer;
    }

    public ContentEntity(String content, String fontFamily, Integer fontStyle, Integer fontSize,
                         float widthPer, float heightPer){
        this.content = content;
        this.fontFamily = fontFamily;
        this.fontStyle = fontStyle;
        this.fontSize = fontSize;
        if(null == this.fontSpace){
            this.fontSpace = fontSize;
        }
        this.widthPer = widthPer;
        this.heightPer = heightPer;
    }

    public ContentEntity(String content, String fontFamily, Integer fontStyle, Integer fontSize,
                         float widthPer, float heightPer, Integer fontDirection){
        this.content = content;
        this.fontFamily = fontFamily;
        this.fontStyle = fontStyle;
        this.fontSize = fontSize;
        if(null == this.fontSpace){
            this.fontSpace = fontSize;
        }
        this.widthPer = widthPer;
        this.heightPer = heightPer;
        this.fontDirection = fontDirection;
    }

}
